<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>C++ Tutorial: STL IV - Algorithms</title>
  <meta
 content="C++ Tutorial: STL IV - Algorithms"
 name="description" />
  <meta
 content="C++ Tutorial, STL IV - Algorithms"
 name="keywords" />
  <meta http-equiv="Content-Type"
 content="text/html; charset=ISO-8859-1" />
  <link type="text/css" rel="stylesheet" href="../images/bogostyleWidePre.css" />
</head>
<body>
<div id="page" align="center">
<div id="content" style="width: 800px;">
<div id="logo">
<div class="whitetitle" style="margin-top: 70px;">bogotobogo </div>
</div>
<div id="topheader">
<div class="headerbodytext" align="left"><br />
<strong>Bogotobogo</strong><br />
contact@bogotobogo.com </div>
<div class="smallgraytext" id="toplinks"><a href="../index.html">Home</a>
| <a href="../sitemap.html">Sitemap</a>
| <a href="../blog" target="_blank">Contact Us</a>
</div>
</div>
<div id="menu">
<div class="smallwhitetext" style="padding: 9px;" align="right"><a
 href="../index.html">Home</a>
| <a href="../about_us.html">About Us</a>
| <a href="../products.html">Products</a>
| <a href="../our_services.html">Our Services</a>
| <a href="../blog" target="_blank">Contact Us</a>
</div>
</div>
<div id="submenu">
<div class="smallgraytext" style="padding: 9px;" align="right">
<a href="../gif.html">Gif</a> 
|<a href="../java_applet.html">JavaApplet/Web Start</a>
| <a href="../flash.html">Flash</a>
| <a href="../shockwave.html">ShockWave</a>
| <a href="../svg.html">SVG</a>
| <a href="../iPhone.html">iPhone/iPad</a>
| <a href="../android.html">Android</a>
| <a href="../OnHTML5.html">HTML5</a>
| <a href="../Algorithms/algorithms.html">Algorithms</a>
| <a href="../News/NewsMain.html">News</a>
| <a href="../cplusplus/cpptut.html">C++</a>
| <a href="../Java/tutorial/on_java.html">Java</a>
| <a href="../php/phptut.html">PHP</a>
| <a href="../DesignPatterns/introduction.html">Design Patterns</a>
| <a href="../python/pytut.html">Python</a> 
| <a href="../CSharp/.netframework.html">C#</a>
| <a href="../forums.html">Forums</a> 
| <a href="../VisualBasicSQL/introduction.html">Visual Basic</a>
</div>
</div>

<div id="contenttext">

<!-- Use of this code assumes agreement with the Google Custom Search Terms of Service. -->
<!-- The terms of service are available at http://www.google.com/cse/docs/tos.html -->
<form name="cse" id="searchbox_demo" action="http://www.google.com/cse">
  <input type="hidden" name="cref" value="" />
  <input type="hidden" name="ie" value="utf-8" />
  <input type="hidden" name="hl" value="" />
  <input name="q" type="text" size="40" />
  <input type="submit" name="sa" value="Search" />
</form>
<script type="text/javascript" src="http://www.google.com/cse/tools/onthefly?form=searchbox_demo&lang="></script>

<div id="bookmarkshare">
<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=khhong7"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=khhong7"></script>
</div>
<br />
<br />
<br />
<br />
<div style="padding: 10px;"><span class="titletext">C++ Tutorial<br />Standard Template Library (STL) IV - Algorithms</span></div>
<img src="../images/cplusplus/cpp_logo.jpg" alt="cplusplus logo"/>

<div class="bodytext" style="padding: 12px;" align="justify"> 
<div class="subtitle_2nd" id="FullList">List of C++ Tutorials</div>
<ul>
   <li><a href="cpptut.html">C++ Home</a> </li>
   <li><a href="string.html">String</a> </li>
   <li><a href="constructor.html">Constructor</a> </li>
   <li><a href="operatoroverloading.html">Operator Overloading</a> </li>
   <li><a href="virtualfunctions.html">Virtual Functions</a></li>
   <li><a href="dynamic_cast.html">Dynamic Cast Operator</a></li>
   <li><a href="typecast.html">Type Cast Operators</a></li>
   <li><a href="autoptr.html">Class auto_ptr</a></li>   
   <li><a href="templates.html">Templates</a></li>
   <li><a href="references.html">References for Built-in Types</a></li>
   <li><a href="valuevsreference.html">Pass by Value vs. Pass by Reference</a></li>
   <li><a href="memoryallocation.html">Memory Allocation</a></li>
   <li><a href="friendclass.html">Friend Functions and Friend Classes</a></li>
   <li><a href="functors.html">Functors (Function Objects)</a></li>
   <li><a href="statics.html">Static Variables and Static Class Members</a></li>
   <li><a href="exceptions.html">Exceptions</a></li>
   <li><a href="pointers.html">Pointers</a></li>
   <li><a href="pointers2.html">Pointers II</a></li>
   <li><a href="pointers3.html">Pointers III</a></li>
   <li><a href="assembly.html">Taste of Assembly</a></li>
   <li><a href="smallprograms.html">Small Programs</a></li>
   <li><a href="linkedlist.html">Linked List Examples</a></li>
   <li><a href="binarytree.html">Binary Tree Example Code</a></li>
   <li><a href="stl.html">Standard Template Library (STL) I</a></li>
   <li><a href="stl2.html">Standard Template Library (STL) II - Maps</a></li>
   <li><a href="stl3_iterators.html">Standard Template Library (STL) III - Iterators</a></li>
   <li><a href="stl4_algorithms.html">Standard Template Library (STL) IV - Algorithms</a></li>
   <li><a href="slicing.html">Object Slicing and Virtual Table</a></li>
   <li><a href="this_pointer.html">The this Pointer</a></li>
   <li><a href="stackunwinding.html">Stack Unwinding</a></li>
   <li><a href="upcasting_downcasting.html">Upcasting and Downcasting</a></li>
   <li><a href="object_returning.html">Object Returning</a></li>
   <li><a href="private_inheritance.html">Private Inheritance</a></li>
   <li><a href="cplusplus_keywords.html">C++_Keywords</a></li>
   <li><a href="multithreaded.html">Multi-Threaded Programming - Terminology</a></li>
   <li><a href="multithreaded2A.html">Multi-Threaded Programming II - Native Thread for Win32 (A) </a></li>
   <li><a href="multithreaded2B.html">Multi-Threaded Programming II -  Native Thread for Win32 (B) </a></li>
   <li><a href="multithreaded2C.html">Multi-Threaded Programming II -  Native Thread for Win32 (C) </a></li>
   <li><a href="multithreaded2.html">Multi-Threaded Programming II - C++ Thread for Win32</a></li>
   <li><a href="multithreaded3.html">Multi-Threaded Programming III - C++ Class Thread for Pthreads</a></li>
   <li><a href="multithreadedDebugging.html">Multithread Debugging</a></li>
   <li><a href="embeddedSystemsProgramming.html">Embedded Systems Programming</a></li>
   <li><a href="boost.html">Boost</a></li>
   <li>Programming Questions and Solutions
    <ul>
       <li><a href="quiz_strings_arrays.html">Strings and Arrays</a></li>
       <li><a href="quiz_linkedlist.html">Linked List</a></li>
       <li><a href="quiz_recursion.html">Recursion</a></li>
       <li><a href="quiz_bit_manipulation.html">Bit Manipulation</a> </li>
       <li><a href="google_interview_questions.html">140 Google Interview Questions</a> </li>
    </ul>
   </li>
</ul>
</div>

<br />
<br />
<img src="images/stl4/NakDongKang.png" alt="NakDongKang"/>
<br />
<br />


<div class="bodytext" style="padding: 12px;" align="justify">
<div class="subtitle" id="Algorithms">Algorithms</div>
<p>The standard algorithms are found in <strong>&lt;algorithms&gt;</strong>. 
There are about 60 standard algorithms are defined in &lt;algorithms&gt;. 
An input sequence is defined by a pair of iterators; an output sequence is defined by an iterator to its first element. 
In general, an algorithm is parameterized by one or more operations that can be defined as functions or as function objects. 
By returning the end of an input sequence, the algorithms indicate failure. For instance, <strong>find(begin, end, x)</strong> returns 
<strong>end</strong> if it can not find <strong>x</strong>.</p>
<br />
<br />


<div class="subtitle_2nd" id="find">find()</div>
<p><strong>find</strong> is one of the nonmodifying sequence operations. It finds the first occurrence of a value in a range:</p>
<pre>
#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

template&lt;class T, class U&gt;
T find(T first, T last, const U&val)
{
	while(first != last && *first != val) ++first;
	return first;
}

int main()
{
	vector&lt;int&gt; v;
	for(int i = 0; i < 10; i++) 
		v.push_back(i);
    
	int x1 = 5, x2 = 100;

	vector&lt;int&gt;::iterator it; 
	<font color="red">it = find(v.begin(),v.end(),x1);</font>
	if(it != v.end()) {
		cout << "found " << x1 << endl;
	}
	else {
		cout << "could not find " << x1 << endl;
	}

	<font color="red">it = find(v.begin(),v.end(),x2);</font>
	if(it != v.end()) {
		cout << "found " << x2 << endl;
	}
	else {
		cout << "could not find " << x2 << endl;
	}
	return 0;
}
</pre>
<p>Output is:</p>
<pre>
found 5
could not find 100
</pre>
<p><strong>find()</strong> operates on a sequence defined by pair of iterators. We're trying to find <strong>val</strong> 
in the range <strong>[fist:last)</strong>. The <strong>find()</strong> returns iterator as the result. The iterator points either 
to the first element of the sequence with the value <strong>val</strong> or to <strong>last</strong>. 
Returning an iterator to the <strong>one-beyond-the-last</strong>  
element of a sequence indicates <strong>not found</strong>. </p>
<p>The sequence consists of all the elements of a container, in this case, <strong>vector</strong>:</p>
<pre>
vector&lt;int&gt;::iterator it; 
it = find(v.begin(),v.end(),x1);
</pre>
<p>The iterator operations used are those of a <strong>vector&lt;int&gt;::iterator</strong>, in other words, <strong>++</strong> simply 
moves a pointer to the next location in memory and <strong>*</strong> dereferences the pointer. </p>
<pre>
while(first != last && *first != val) ++first;
</pre>
<p>The iterator comparison, <strong>first != last</strong> is a pointer comparison, and the value comparison <strong>*first != val</strong> simply compares two integers.</p>
<p>We check the returned iterator against the end of our sequence to see if we found the value:</p>
<pre>
if(it != v.end()) { 
</pre>
<p>We could have written the implicit loop of the <strong>find()</strong> more explicitly:</P>
<pre>
template&lt;class T, class U&gt;
T find(T first, T last, const U&val)
{
	for(T iter = first; iter != last; ++iter) 
		if(*iter == val) return iter;
	return last;
}
</pre>
<p>Note that we needed addition variable <strong>iter</strong>. So, the original <strong>find()</strong> may be more 
efficient and more compact.</p>
<p>The <strong>find()</strong> algorithm we wrote is generic. In other words, it can be used for different data types. </p>
<p>Here is an example using <strong>list</strong> instead of <strong>vector</strong> with the same <strong>find()</strong>:</p>
<pre>
#include <iostream>
#include <list>
#include <string>

using namespace std;

template&lt;class T, class U&gt;
T find(T first, T last, const U&val)
{
	while(first != last && *first != val) ++first;
	return first;
}

int main()
{
	<font color="red">list&lt;string&gt; myList(3);</font>	// creates a list with 3 elements
	myList.push_back ("A");
	myList.push_front("B");
	myList.push_back("C");
    
	string x1 = "B", x2 = "F";

	<font color="red">list&lt;string&gt;::iterator it;</font>
 
	<font color="red">it = find(myList.begin(),myList.end(),x1);</font>
	if(it != myList.end()) {
		cout << "found " << x1 << endl;
	}
	else {
		cout << "could not find " << x1 << endl;
	}

	<font color="red">it = find(myList.begin(),myList.end(),x2);</font>
	if(it != myList.end()) {
		cout << "found " << x2 << endl;
	}
	else {
		cout << "could not find " << x2 << endl;
	}
	return 0;
}
</pre>
<p>Output is:</p>
<pre>
found B
could not find F
</pre>
<p>Here, the iteration for <strong>find()</strong> is that of a <strong>list&lt;string&gt;::iterator</strong>. 
The operators have the required meaning, so that the underlying logic remains the same as for the 
<strong>vector&lt;int&gt;</strong> of the previous example. However, the implementation is different. In other words, 
<strong>++</strong> of the <strong>++first</strong> simply follows a pointer in the <strong>link (or next)</strong> part of the 
element to where the next element of the <strong>list</strong> is stored.</p>
<p>From the examples above, we can easily find that the <strong>find()</strong> is extremely flexible as long as 
we obey the simple rules for iterators.</p>
<br />
<br />


<div class="subtitle_2nd" id="find_if">find_if()</div>
<p>Typically, we don't look for a specific value, rather we are more often look for a value that meets a certain criteria. 
The <strong>find()</strong> would be more useful if we could set our own find criteria. The standard algorithm that searches 
based on a criterion of user's choice is <strong>find_if()</strong>:</p>
<pre>
template&lt;class T, class P&gt;
T find_if(T first, T last, P predicate)
{
	while(first != last && !predicate(*first) ++first;
	return first;
}
</pre> 
<p>When we compare the <strong>find_if()</strong> with <strong>find()</strong>, it uses <strong>!predicate(*first)</strong> as 
a stop condition rather than <strong>*first != val</strong>. So, it stops searching once the <strong>predicate()</strong> succeeds 
rather than when an element has the same value with <strong>val</strong>.</p>
<p>A <a href="functors.html#Predicates" target="_blank">predicate</a> is a function that returns 
<strong>true</strong> or <strong>false</strong>. Our <strong>find_if()</strong> needs a predicate that takes one argument so that it can 
say <strong>predicate(*first)</strong>. </p>
<p>Here are the examples of predicates:</p>
<pre>
bool GreaterThan5(double d) { return 5.0 < d; }
bool FirstEven(int n) { return !(n % 2);}
</pre> 
<p>And the complete code of using the <strong>predicates</strong> and <strong>find_if()</strong> is:</p>
<pre>
#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;list&gt;

using namespace std;

template&lt;class T, class P&gt;
T find_if(T first, T last, P predicate)
{
	while(first != last && <font color="red">!predicate(*first)</font>) ++first;
	return first;
}

<font color="red">bool GreaterThan5(double d) { return 5.0 < d; }
bool FirstEven(int n) { return !(n % 2);}</font>

void f1(vector&lt;double&gt;&v)
{
	vector&lt;double&gt;::iterator it = find_if(v.begin(), v.end(), <font color="red">GreaterThan5</font>);
	if(it != v.end()) 
		cout << "found " << *it << endl;
	else
		cout << "could not find " << endl;
}

void f2(list&lt;int&gt;&l)
{
	list&lt;int&gt;::iterator it = find_if(l.begin(), l.end(), <font color="red">FirstEven</font>);
	if(it != l.end()) 
		cout << "found " << *it << endl;
	else
		cout << "could not find " << endl;
}

int main()
{
	vector&lt;double&gt; v;
	for(int i = 1; i <= 10; i++) 
		v.push_back(i*1.0);

	list&lt;int&gt; myList;
	for(int i = 1;  i <= 10; i++) 
		myList.push_back(i);
	f1(v);
	f2(myList);

	return 0;
}
</pre>
<p>Output from the run is:</p>
<pre>
found 6
found 2
</pre>
<p>The <strong>find_if()</strong> calls <strong>GreaterThan5()</strong> or <strong>FirstEven()</strong> for each element until 
it finds the right element.</p>
<br />
<br />

<div class="subtitle_2nd" id="functionobject">Functors</div>
<p>In the previous example, we used a predicate:</p>
<pre>
bool GreaterThan5(double d) { return 5.0 < d; } 
</pre>
<p>That is ugly because if we want to find an element greater than 10, we have to make another one. 
So, we need to find a better way! Let's investigate what the property of <strong>GreaterThan()</strong> predicate. 
First, we can call it as a predicate like <strong>predicate(*first)</strong>. Second, we can store a value, 
such as <strong>10</strong> or <strong>x</strong> so that it can be used when called.</p>
<p>That's the reason why we need a <a href="functors.html" target="_blank">function object</a>. In other words, we need an object that can behave 
like a function while it can store data. Here is the object we need:</p>
<pre>
class GreaterThan
{
	int data;
public:
	GreaterThan(int n):data(n) {}
	<font color="red">bool operator()(int n) const { return n > data; }</font>
};
</pre>
<p>When we say <strong>GreaterThan(5)</strong>, we make an object of class <strong>GreaterThan</strong> holding 
<strong>5</strong> as its member <strong>data</strong>:</p>
<pre>
find_if(v.begin(), v.end(), GreaterThan(5));
</pre>
<p>We pass that object to <strong>find_if()</strong> as its parameter called <strong>predicate</strong>. For 
each element of <strong>v</strong>, <strong>find_if()</strong> makes a call</p>
<pre>
predicate(*first)
</pre>
<p>This will invoke <strong>GreaterThan::operator()</strong> which is our function object using the argument <strong>*first</strong>.
The result is a comparison of the element's value, <strong>*first</strong>, with <strong>5</strong>.</p>
<p>What do we see here? The function call can be seen as an operator, the <strong>() operator</strong>, just like any operator. 
Therefore, <strong>()</strong> in <strong>predicate(*first)</strong> is given a meaning by 
<strong>GreaterThan::operator()</strong>, just as subscripting in <strong>v[i]</strong> is given a meaning by
 <strong>vector::operator[]</strong>.</p>
<p>Here is the complete code:</p>
<pre>
#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;list&gt;

using namespace std;


template&lt;class T, class P&gt;
T find_if(T first, T last, P predicate)
{
	while(first != last && !predicate(*first)) ++first;
	return first;
}

<font color="red">class GreaterThan
{
	int data;
public:
	GreaterThan(int n):data(n) {}
	bool operator()(int n) const { return n > data; }
};</font>

void f(vector&lt;int&gt;&v)
{
	vector&lt;int&gt;::iterator it = find_if(v.begin(), v.end(), GreaterThan(5));
	if(it != v.end()) 
		cout << "found " << *it << endl;
	else
		cout << "could not find " << endl;
}

int main()
{
	vector&lt;int&gt; v;
	for(int i = 1; i <= 10; i++) 
		v.push_back(i);

	f(v);

	return 0;
}
</pre>
<p>Now, we established a way of allowing a function to carry around data that it needs. Obviously,
the function objects provide us with a very powerful and convenient mechanism.</p>

<br />
<br />


<div class="subtitle_2nd" id="accumulate">accumulate()</div>
<p><strong>accumulate()</strong> is one of the simplest and most useful numerical algorithm:</p>
<pre>
a = accumulate(b,e,val)
</pre>
<p>It adds a sequence of values, and the type of the result <strong>a</strong> is the type of the 
initial value <strong>val</strong>. <br />It is found in <strong>&lt;numeric&gt;</strong>.</p>
<pre>
#include &lt;iostream&gt;

template &lt;typename T, typename U&gt;
U accumulate(T first, T last, U acc)
{
	while (first != last) {
		acc = acc + *first;
		++first;
	}
	return acc;
}

int main()
{
	int a[] = {1,2,3,4,5,6,7,8,9,10};
	std::cout << accumulate(a, a + sizeof(a)/sizeof(int), 0) << std::endl; // 55	
	return 0;
}
</pre>
<p>Here is another <strong>accumulator()</strong> which has four arguments, with the last one,
we can specify the operation to be used:</p>
<pre>
#include &lt;iostream&gt;
#include &lt;vector&gt;
<font color="red">#include &lt;functional&gt;</font>

using namespace std;

template &lt;typename T, typename U, <font color="red">typename Op</font>&gt;
U accumulate(T first, T last, U acc, <font color="red">Op op</font>)
{
	while (first != last) {
		acc = <font color="red">op(acc, *first);</font>
		++first;
	}
	return acc;
}


int main()
{
	vector&lt;double&gt; v;  
	v.push_back(1);v.push_back(2);v.push_back(3);v.push_back(4);v.push_back(5);

	std::cout << accumulate(v.begin(),v.end(), 1.0, <font color="red">multiplies&lt;double&gt;()</font>) << std::endl; 
	std::cout << accumulate(v.begin(),v.end(), 1.0, <font color="red">divides&lt;double&gt;()</font>) << std::endl;
	
	return 0;
}
</pre>
<p>Output is:</p>
<pre>
120
0.00833333
</pre>
<br />
<br />


<div class="subtitle_2nd" id="listOfAlgorithms">List of algorithms</div>
<ul>
    <li><strong>r=find(b,e,v)</strong>
    <p><strong>r</strong> points to the first occurrence of <strong>v</strong> in [<strong>b</strong>:<strong>e</strong>).</p>
    </li>
    <li><strong>r=find_if(b,e,v)</strong>
    <p><strong>r</strong> points to the first occurrence of <strong>v</strong> in <strong>[b:e)</strong> so that <strong>v(x)</strong> is <strong>true</strong>.</p>
    </li>
    <li><strong>r=count(b,e,v)</strong>
    <p><strong>r</strong> is the number of occurrence of <strong>v</strong> in <strong>[b:e)</strong>.</p>
    </li>
    <li><strong>r=count_if(b,e,v)</strong>
    <p><strong>r</strong> is the number of occurrence in <strong>[b:e)</strong> so that <strong>v(x)</strong> is <strong>true</strong>.</p>
    </li>
    <li><strong>sort(b,e)</strong>
    <p>Sort <strong>[b,e)</strong> using <strong>&lt;</strong>.</p>
    </li>
    <li><strong>sort(b,e,v)</strong>
    <p>Sort <strong>[b,e)</strong> using <strong>v</strong>.</p>
    </li>
    <li><strong>copy(b,e,b2)</strong>
    <p>Copy <strong>[b,e)</strong> to <strong>[b2:b2+(e-b))</strong>; there had better be enough elements after  <strong>b2</strong>.</p>
    </li>
    <li><strong>unique_copy(b,e,b2)</strong>
    <p>Copy <strong>[b,e)</strong> to <strong>[b2:b2+(e-b))</strong>; don't copy adjacent duplicates.</p>
    </li>
    <li><strong>merge(b,e,b2,e2,r)</strong>
    <p>Merge two sorted sequencec <strong>[b2,e2)</strong> and <strong>[b,e)</strong> into <strong>[r:r+(e-b)+(e2-b2))</strong>.</p>
    </li>
    <li><strong>r=equal_range(b,e,v)</strong>
    <p><strong>r</strong> is te subsequence of the sorted range <strong>[b,e)</strong> with the value <strong>v</strong>, basically, a binary search for <strong>v</strong>.</p>
    </li>
    <li><strong>equal(b,e,b2)</strong>
    <p>Do all elements of <strong>[b,e)</strong> and <strong>[b2:b2+(e-b))</strong> compare equal?</p>
    </li>
    <li><strong>x=accumulate(b,e,i)</strong>
    <p><strong>x</strong> is the sum of <strong>i</strong> and the elements of <strong>[b,e)</strong>.</p>
    </li>
    <li><strong>x=accumulate(b,e,i,op)</strong>
    <p>Like the other <strong>accumulate</strong>, but with the sum calculate using <strong>op</strong>.</p>
    </li>
    <li><strong>x=inner_product(b,e,b2,i)</strong>
    <p><strong>x</strong> is the inner product of <strong>[b,e)</strong> and <strong>[b2:b2+(e-b))</strong>.</p>
    </li>
    <li><strong>x=inner_product(b,e,b2,i,op,op2)</strong>
    <p>Like the othe <strong>inner_product</strong>, but with  <strong>op</strong> and <strong>op2</strong> instead of <strong>+</strong> and <strong>*</strong>.</p>
    </li>
</ul>
<br />
<br />
<img src="images/stl4/JumBongSan.png" alt="JumBongSan"/>
<br />
<br />


<br /><br />
<div class="subtitle_2nd" id="FullList">List of C++ Tutorials</div>
<ul>
   <li><a href="cpptut.html">C++ Home</a> </li>
   <li><a href="string.html">String</a> </li>
   <li><a href="constructor.html">Constructor</a> </li>
   <li><a href="operatoroverloading.html">Operator Overloading</a> </li>
   <li><a href="virtualfunctions.html">Virtual Functions</a></li>
   <li><a href="dynamic_cast.html">Dynamic Cast Operator</a></li>
   <li><a href="typecast.html">Type Cast Operators</a></li>
   <li><a href="autoptr.html">Class auto_ptr</a></li>
   <li><a href="templates.html">Templates</a></li>
   <li><a href="references.html">References for Built-in Types</a></li>
   <li><a href="valuevsreference.html">Pass by Value vs. Pass by Reference</a></li>
   <li><a href="memoryallocation.html">Memory Allocation</a></li>
   <li><a href="friendclass.html">Friend Functions and Friend Classes</a></li>
   <li><a href="functors.html">Functors</a></li>
   <li><a href="statics.html">Static Variables and Static Class Members</a></li>
   <li><a href="exceptions.html">Exceptions</a></li>
   <li><a href="pointers.html">Pointers</a></li>
   <li><a href="pointers2.html">Pointers II</a></li>
   <li><a href="pointers3.html">Pointers III</a></li>
   <li><a href="assembly.html">Taste of Assembly</a></li>
   <li><a href="smallprograms.html">Small Programs</a></li>
   <li><a href="linkedlist.html">Linked List Examples</a></li>
   <li><a href="binarytree.html">Binary Tree Example Code</a></li>
   <li><a href="stl.html">Standard Template Library (STL) I</a></li>
   <li><a href="stl2.html">Standard Template Library (STL) II - Maps</a></li>
   <li><a href="stl3_iterators.html">Standard Template Library (STL) III - Iterators</a></li>
   <li><a href="stl4_algorithms.html">Standard Template Library (STL) IV - Algorithms</a></li>
   <li><a href="slicing.html">Object Slicing and Virtual Table</a></li>
   <li><a href="this_pointer.html">The this Pointer</a></li>
   <li><a href="stackunwinding.html">Stack Unwinding</a></li>
   <li><a href="upcasting_downcasting.html">Upcasting and Downcasting</a></li>
   <li><a href="object_returning.html">Object Returning</a></li>
   <li><a href="private_inheritance.html">Private Inheritance</a></li>
   <li><a href="cplusplus_keywords.html">C++_Keywords</a></li>
   <li><a href="multithreaded.html">Multi-Threaded Programming - Terminology</a></li>
   <li><a href="multithreaded2A.html">Multi-Threaded Programming II - Native Thread for Win32 (A) </a></li>
   <li><a href="multithreaded2B.html">Multi-Threaded Programming II -  Native Thread for Win32 (B) </a></li>
   <li><a href="multithreaded2C.html">Multi-Threaded Programming II -  Native Thread for Win32 (C) </a></li>
   <li><a href="multithreaded2.html">Multi-Threaded Programming II - C++ Thread for Win32</a></li>
   <li><a href="multithreaded3.html">Multi-Threaded Programming III - C++ Class Thread for Pthreads</a></li>
   <li><a href="multithreadedDebugging.html">Multithread Debugging</a></li>
   <li><a href="embeddedSystemsProgramming.html">Embedded Systems Programming</a></li>
   <li><a href="boost.html">Boost</a></li>
   <li>Programming Questions and Solutions
    <ul>
       <li><a href="quiz_strings_arrays.html">Strings and Arrays</a></li>
       <li><a href="quiz_linkedlist.html">Linked List</a></li>
       <li><a href="quiz_recursion.html">Recursion</a></li>
       <li><a href="quiz_bit_manipulation.html">Bit Manipulation</a> </li>
       <li><a href="google_interview_questions.html">140 Google Interview Questions</a> </li>
    </ul>
   </li>
</ul>
<br /><br />


<br />


<br />
<br />
<br />


</div>
</div>
<div class="smallgraytext" id="footer"><a href="../index.html">Home</a>
| <a href="../about_us.html">About Us</a>
| <a href="../products.html">products</a>
| <a href="../our_services.html">Our Services</a>
| <a href="#">Contact Us</a>
| Bogotobogo &copy; 2011 | <a target="_blank" href="http://www.bogotobogo.com">Bogotobogo </a>
</div>
</div>
</div>
</body>
</html>
